package com.ruoyi.project.myexment;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.project.property.domain.LabProperty;
import com.ruoyi.project.property.service.ILabPropertyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@Controller
@RequestMapping("website/exment")
public class ExmentController extends BaseController {
    private String prefix = "system/exment";
    @Autowired
    private ILabPropertyService labPropertyService;

    @RequiresPermissions("website:exment:view")
    @GetMapping()
    public String exment()
    {
        return prefix + "/list";
    }

    /**
     * 查询【请填写功能名称】列表
     */
    @RequiresPermissions("system:exment:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(LabProperty labProperty)
    {
        TableDataInfo rspData = new TableDataInfo();
        List<ExmentController.Exment> userList = new ArrayList<ExmentController.Exment>(Arrays.asList(new ExmentController.Exment[exments.size()]));
        Collections.copy(userList, exments);
        PageDomain pageDomain = TableSupport.buildPageRequest();
        if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
        {
            rspData.setRows(userList);
            rspData.setTotal(userList.size());
            return rspData;
        }
        Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
        Integer pageSize = pageDomain.getPageNum() * 10;
        if (pageSize > userList.size())
        {
            pageSize = userList.size();
        }
        rspData.setRows(userList.subList(pageNum, pageSize));
        rspData.setTotal(userList.size());
        return rspData;
    }


    private final static List<ExmentController.Exment> exments= new ArrayList<ExmentController.Exment>();
    {


        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","开放中","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));
        exments.add(new ExmentController.Exment(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10 11::33:00","2019-09-10 11::33:00","张老师","未预约","A502-2019年11月12日 （第2-3节）"));

    }
    class Exment{
            /** $column.columnComment */
            private Long id;
            /** 实验名称 */
            private String exmentName;
            /** 课程名称 */
            private String courseName;

            /** 开始时间*/
            private String startTime;
            /** 结束时间 */
            private String stopTime;
            /** 创建者 */
            private String createTer;
            /** 状态 */
            private String staTus;
            /** 实验信息 */
            private String exmentMessage;

        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }

        public String getExmentName() {
            return exmentName;
        }

        public void setExmentName(String exmentName) {
            this.exmentName = exmentName;
        }

        public String getCourseName() {
            return courseName;
        }

        public void setCourseName(String courseName) {
            this.courseName = courseName;
        }

        public String getStartTime() {
            return startTime;
        }

        public void setStartTime(String startTime) {
            this.startTime = startTime;
        }

        public String getStopTime() {
            return stopTime;
        }

        public void setStopTime(String stopTime) {
            this.stopTime = stopTime;
        }

        public String getCreateTer() {
            return createTer;
        }

        public void setCreateTer(String createTer) {
            this.createTer = createTer;
        }

        public String getStaTus() {
            return staTus;
        }

        public void setStaTus(String staTus) {
            this.staTus = staTus;
        }

        public String getExmentMessage() {
            return exmentMessage;
        }

        public void setExmentMessage(String exmentMessage) {
            this.exmentMessage = exmentMessage;
        }

        public Exment(Long id, String exmentName, String courseName, String startTime, String stopTime, String createTer, String staTus, String exmentMessage ) { this.id = id;
           this.exmentName=exmentName;
           this.courseName=courseName;
           this.startTime=startTime;
           this.stopTime=stopTime;
           this.createTer=createTer;
           this.staTus=staTus;
           this.exmentMessage=exmentMessage;

        }


    }
}
